﻿<CascadingAuthenticationState>
    <Router AppAssembly="@typeof(Program).Assembly" OnNavigateAsync="OnNavigateAsync">
        <Found Context="routeData">
            <CascadingValue Value="@routeData">
                <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(BaseLayout)">
                    <NotAuthorized>
                        @if (@context.User.Identity?.IsAuthenticated is true)
                        {
                            <p>You are not authorized to be here.</p>
                        }
                        else
                        {
                            <Login />
                        }
                    </NotAuthorized>
                </AuthorizeRouteView>
                <FocusOnNavigate RouteData="@routeData" Selector="h1" />
            </CascadingValue>
        </Found>
        <NotFound>
            <LayoutView Layout="@typeof(NotFound)">
                <p>Sorry, there's nothing at this address.</p>
            </LayoutView>
        </NotFound>
    </Router>
</CascadingAuthenticationState>
